package com.hxzy.tms.entity;

import java.io.Serializable;
import java.util.Set;

public class Team implements Serializable {
    private static final long serialVersionUID = -8990871560942747441L;

    public static final int STATUS_NORMAL = 1; // 尚未开始
    public static final int STATUS_PROCCESING = 2; // 正在实训中
    public static final int STATUS_PROJECTING = 3; // 毕业项目实战
    public static final int STATUS_FINISHED = 4; // 完成实训
    public static final int STATUS_CLOSED = 5; // 结束团队

    private Long id;
    private String name;
    private String desc;
    private String intro;
    private String subdomain;
    private Integer status;
    private Integer userCount;
    private Long gmtBegin;
    private Long gmtEnd;
    // private Long uidCreate;
    // private Long uidModified;
    private User userCreate;
    private User userModified;
    private Long gmtCreate;
    private Long gmtModified;
    private Set<Project> projects;

    public Team() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getSubdomain() {
        return subdomain;
    }

    public void setSubdomain(String subdomain) {
        this.subdomain = subdomain;
    }

    public java.lang.Integer getStatus() {
        return status;
    }

    public void setStatus(java.lang.Integer status) {
        this.status = status;
    }

    public Long getGmtBegin() {
        return gmtBegin;
    }

    public void setGmtBegin(Long gmtBegin) {
        this.gmtBegin = gmtBegin;
    }

    public Long getGmtEnd() {
        return gmtEnd;
    }

    public void setGmtEnd(Long gmtEnd) {
        this.gmtEnd = gmtEnd;
    }

    public User getUserCreate() {
        return userCreate;
    }

    public void setUserCreate(User userCreate) {
        this.userCreate = userCreate;
    }

    public User getUserModified() {
        return userModified;
    }

    public void setUserModified(User userModified) {
        this.userModified = userModified;
    }

    public Long getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Long gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Long getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Long gmtModified) {
        this.gmtModified = gmtModified;
    }

    public Integer getUserCount() {
        return userCount;
    }

    public void setUserCount(Integer userCount) {
        this.userCount = userCount;
    }

    public Set<Project> getProjects() {
        return projects;
    }

    public void setProjects(Set<Project> projects) {
        this.projects = projects;
    }

    public String getProcess() {
        int now = (int) (System.currentTimeMillis() / 1000);
        int finished = now - gmtBegin.intValue();
        if (finished <= 0) {
            return "0%";
        }
        long allProcess = gmtEnd - gmtBegin;
        if (allProcess <= 0) {
            return "100%";
        }

        return String.format("%.2f%", (finished / allProcess));
    }

}
